package thread.state;

/**
 * @author 真香
 * @create 2021-06-03 21:51
 */


/**
 * 测试线程 优先执行 join方法
 *
 *
 */
public class TestJoin  implements Runnable{
    @Override
    public void run() {

        for (int i = 0; i < 100; i++) {
            System.out.println("join 线程插队进来了...."+i);
        }
    }


    public static void main(String[] args) throws InterruptedException {
        // 自定义线程
        TestJoin testJoin = new TestJoin();
        Thread thread = new Thread(testJoin);
        thread.start();

        // main线程 主线程

        for (int i = 0; i < 500; i++) {

            if (i == 200) {
                thread.join();
            }
            System.out.println("main 线程"+i);

        }



    }
}
